
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>系统登录</title>
</head>
<body>

	<fieldset class="layui-elem-field" style='margin: 20px; padding: 20px'>
		<legend>系统登录</legend>
		<div class="layui-field-box">
			<form class="layui-form layui-form-pane">
				<div class="layui-form-item">
					<label class="layui-form-label">账户</label>
					<div class="layui-input-inline">
						<input type="text" name="code" required lay-verify="required"
							placeholder="请输入账户" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-inline">
						<input type="password" name="pass" required lay-verify="required"
							placeholder="请输入密码" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label"> <img
						src="/test6/AuthCodeServlet"
						onclick='this.src="/test6/AuthCodeServlet?"+Math.random()' />
					</label>
					<div class="layui-input-inline">
						<input type="text" name="authCode" required lay-verify="required"
							placeholder="请输入验证码" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input type="button" value='登录' lay-submit lay-filter="login"
							class="layui-btn" /> <input type="reset" value='重置'
							class="layui-btn" />
					</div>
					<input type="button" value='跳转注册' class="layui-btn "
						onclick="toJsp('/web/reg.jsp')" />
				</div>
				<input type="hidden" name='action' value='login' />
			</form>
		</div>
	</fieldset>

	<script type="text/javascript">
		//var form = layui.form;
		// var $ = layui.jquery;
		//var layer = layui.layer;
		//form.on('submit(login)',function(data){//事件监听/绑定
		// console.log(data.field)//网页控制台
		// $.ajax({
		//	 type:"post",//请求方式
		// data:data.field,//请求参数
		// url:base.app+"/employee",//请求路径
		// dataType:"text",//返回数据类型
		// success:function(data){
		//	console.log(data)
		//	//layer.msg(data);
		//	if('L' == data){
		//		layer.msg("验证码错误")
		//	}
		//	 else if('0'==data){
		//		layer.msg("账号不存在")
		//	}else if('1'== data){
		//		layer.msg("登录成功")
		//	}else{
		//	layer.msg("密码错误")
		//}
		// }
		// });
		//})
		fromOn('/employee', 'submit(login)', 'text', function(data) {
			//			console.log(data)
			if ('L' == data) {
				layer.msg("验证码错误")
			} else if ('0' == data) {
				layer.msg("账号不存在")
			} else if ('1' == data) {
				layer.msg("登录成功", {
					time : 1000
				//1秒关闭（不配置默认3秒）
				}, function() {
					toJsp('/web/page/main.jsp')
				})
			} else {
				layer.msg("密码错误")
			}
		})
	</script>

</body>
</html>